# -*- coding: UTF-8 -*-

import os
myjson = {"name": "汤姆", "city": "火城", "age": 6, "spc": None}

def creFile():
    with open(os.path.join(os.getcwd(),'text.txt'),'w+',encoding='UTF-8') as f:
        for key,values in myjson.items():
            f.write('{}:{}'.format(key,values))
            f.write('\r')

def openFile():
    with open('text.txt','r+',encoding='UTF-8')  as owf:
        lines=owf.readlines()
        owf.seek(0)
        for i in lines:
            lns=i.replace('None','喷火')   #替换更新内容
            owf.write(lns)
creFile()
openFile()